home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / util / moni / Scout-src.lha / include / CompilerSpecific.h next >
C/C++ Source or Header  |  2002-09-16  |  7KB  |  238 lines

  1. #ifndef COMPILERSPECIFIC_H
  2. #define COMPILERSPECIFIC_H
  3. /*
  4. **  $VER: CompilerSpecific.h 2.2 (1.10.97)
  5. **
  6. **  Copyright (C) 1997 Bernardo Innocenti. All rights reserved.
  7. **
  8. **  Compiler specific definitions is here. You can add support
  9. **  for other compilers in this header. Please return any changes
  10. **  you make to me, so I can add them to my personal copy of this file.
  11. **
  12. **  Here is a short description of the macros defined below:
  13. **
  14. **  LIBCALL
  15. **      Shared library entry point, with register args
  16. **
  17. **  HOOKCALL
  18. **      Hook or boopsi dispatcher entry point with arguments
  19. **      passed in registers
  20. **
  21. **  INLINE
  22. **      Please put function body inline to the calling code
  23. **
  24. **  STDARGS
  25. **      Function uses standard C conventions for arguments
  26. **
  27. **  ASMCALL
  28. **      Function takes arguments in the specified 68K registers
  29. **
  30. **  REGCALL
  31. **      Function takes arguments in registers choosen by the compiler
  32. **
  33. **  CONSTCALL
  34. **      Function does not modify any global variable
  35. **
  36. **  FORMATCALL(archetype,string_index,first_to_check)
  37. **      Function uses printf or scanf-like formatting
  38. **
  39. **  SAVEDS
  40. **      Function needs to reload context for small data model
  41. **
  42. **  INTERRUPT
  43. **      Function will be called from within an interrupt
  44. **
  45. **  NORETURN
  46. **      Function does never return
  47. **
  48. **  ALIGNED
  49. **      Variable must be aligned to longword boundaries
  50. **
  51. **  CHIP
  52. **      Variable must be stored in CHIP RAM
  53. **
  54. **  REG(reg,arg)
  55. **      Put argument <arg> in 68K register <reg>
  56. **
  57. **  min(a,b)
  58. **      Return the minimum between <a> and <b>
  59. **
  60. **  max(a,b)
  61. **      Return the maximum between <a> and <b>
  62. **
  63. **  abs(a)
  64. **      Return the absolute value of <a>
  65. **
  66. **  _COMPILED_WITH
  67. **      A string containing the name of the compiler
  68. */
  69.  
  70. #ifdef __SASC
  71.     /* SAS/C 6.58 or better */
  72.  
  73.     #define INLINE      static __inline
  74.     #define STDARGS     __stdargs
  75.     #define ASMCALL     __asm
  76.     #define REGCALL     __regcall
  77.     #define CONSTCALL   /* unsupported */
  78.     #define FORMATCALL  /* unsupported */
  79.     #define SAVEDS      __saveds
  80.     #define INTERRUPT   __interrupt
  81.     #define NORETURN    /* unsupported */
  82.     #define ALIGNED     __aligned
  83.     #define CHIP        __chip
  84.     #define REG(reg,arg) register __##reg arg
  85.     #define _COMPILED_WITH  "SAS/C"
  86.  
  87.     /* For min(), max() and abs() */
  88.     #ifndef USE_BUILTIN_MATH
  89.     #define USE_BUILTIN_MATH
  90.     #endif
  91.     #include <string.h>
  92. #else
  93. #ifdef __GNUC__
  94.     /* GeekGadgets GCC 2.7.2.1 or better */
  95.  
  96.     #define INLINE      static __inline
  97.     #define STDARGS     __stdargs
  98.     #define ASMCALL     /* nothing */
  99.     #define REGCALL     /* nothing */
  100.     #define CONSTCALL   __attribute__((const))
  101.     #define FORMATCALL(a,s,f)   __attribute__((format(a,s,f)))
  102.     #define SAVEDS      __attribute__((saveds))
  103.     #define INTERRUPT   __attribute__((interrupt))
  104.     #define NORETURN    __attribute__((noreturn))
  105.     #define ALIGNED     __attribute__((aligned(4)))
  106.     #define REG(reg,arg) arg __asm(#reg)
  107.     #define _COMPILED_WITH  "GCC"
  108.  
  109.     #define min(a,b)    (((a)<(b))?(a):(b))
  110.     #define max(a,b)    (((a)>(b))?(a):(b))
  111.     #define abs(a)      (((a)>0)?(a):-(a))
  112.  
  113.     /* GCC produces code which calls these two functions
  114.      * to initialize and copy structures and arrays.
  115.      */
  116.     void INLINE STDARGS bzero (char *buf, int len)
  117.         { while (len--) *buf++ = 0; }
  118.  
  119.     void INLINE STDARGS bcopy (char *src, char *dest, int len)
  120.         { while (len--) *dest++ = *src++; }
  121.  
  122. #else
  123. #ifdef __STORM__
  124.     /* StormC 2.00.23 or better */
  125.     #define INLINE      __inline
  126.     #define STDARGS     /* nothing */
  127.     #define ASMCALL     /* nothing */
  128.     #define REGCALL     register
  129.     #define CONSTCALL   /* unsupported */
  130.     #define FORMATCALL  /* unsupported */
  131.     #define SAVEDS      __saveds
  132.     #define INTERRUPT   __interrupt
  133.     #define NORETURN    /* unsupported */
  134.     #define ALIGNED     /* unsupported */
  135.     #define CHIP        __chip
  136.     #define REG(reg,arg) register __##reg arg
  137.     #define _COMPILED_WITH  "StormC"
  138.  
  139.     #define min(a,b)    (((a)<(b))?(a):(b))
  140.     #define max(a,b)    (((a)>(b))?(a):(b))
  141.     #define abs(a)      (((a)>0)?(a):-(a))
  142.  
  143.     #define _INLINE_INCLUDES
  144.     #include <string.h>
  145. #else
  146. #ifdef __MAXON__
  147.     /* Maxon C/C++ */
  148.  
  149.     #define INLINE      static inline
  150.     #define STDARGS     /* ? */
  151.     #define ASMCALL     /* ? */
  152.     #define REGCALL     /* ? */
  153.     #define CONSTCALL   /* unsupported */
  154.     #define FORMATCALL  /* unsupported */
  155.     #define SAVEDS      __saveds
  156.     #define INTERRUPT   __interrupt
  157.     #define NORETURN    /* unsupported */
  158.     #define ALIGNED     __aligned
  159.     #define REG(reg,arg) register __##reg arg
  160.     #define _COMPILED_WITH  "Maxon C"
  161.  
  162.     /* For min(), max() and abs() */
  163.     #define USE_BUILTIN_MATH
  164.     #include <string.h>
  165.  
  166.     #error Maxon C compiler support is untested. Please check all the above definitions
  167. #else
  168. #ifdef _DCC
  169.     /* DICE C */
  170.  
  171.     #define INLINE      static __inline
  172.     #define STDARGS     __stdargs
  173.     #define ASMCALL     /* nothing */
  174.     #define REGCALL     /* ? */
  175.     #define CONSTCALL   /* unsupported */
  176.     #define FORMATCALL  /* unsupported */
  177.     #define SAVEDS      __geta4
  178.     #define INTERRUPT   /* unsupported */
  179.     #define NORETURN    /* unsupported */
  180.     #define ALIGNED     __aligned
  181.     #define REG(reg,arg)    __##reg arg
  182.     #define _COMPILED_WITH  "DICE"
  183.  
  184.     #define min(a,b)    (((a)<(b))?(a):(b))
  185.     #define max(a,b)    (((a)>(b))?(a):(b))
  186.     #define abs(a)      (((a)>0)?(a):-(a))
  187.  
  188.     #error DICE compiler support is untested. Please check all the above definitions
  189. #else
  190. #ifdef AZTEC_C
  191.     /* Aztec/Manx C */
  192.  
  193.     #define INLINE      static
  194.     #define STDARGS     /* ? */
  195.     #define ASMCALL     /* ? */
  196.     #define REGCALL     /* ? */
  197.     #define CONSTCALL   /* unsupported */
  198.     #define FORMATCALL  /* unsupported */
  199.     #define SAVEDS      __geta4
  200.     #define INTERRUPT   /* unsupported */
  201.     #define NORETURN    /* unsupported */
  202.     #define ALIGNED     __aligned
  203.     #define REG(reg,arg)    __##reg arg
  204.     #define _COMPILED_WITH  "Manx C"
  205.  
  206.     #define min(a,b)    (((a)<(b))?(a):(b))
  207.     #define max(a,b)    (((a)>(b))?(a):(b))
  208.     #define abs(a)      (((a)>0)?(a):-(a))
  209.  
  210.     #error Aztec/Manx C compiler support is untested. Please check all the above definitions
  211. #else
  212.     #error Please add compiler specific definitions for your compiler
  213. #endif
  214. #endif
  215. #endif
  216. #endif
  217. #endif
  218. #endif
  219.  
  220.  
  221. /* Special function attributes */
  222.  
  223. #define ASM         ASMCALL
  224. #define LIBCALL     ASMCALL SAVEDS
  225. #define HOOKCALL    ASMCALL SAVEDS
  226.  
  227.  
  228. /* AROS Compatibility: IPTR is a type which can store a pointer
  229.  * as well as a long integer.
  230.  */
  231. #ifndef IPTR
  232. #define IPTR LONG
  233. #endif /* IPTR */
  234.  
  235.  
  236.  
  237. #endif /* !COMPILERSPECIFIC_H */
  238.